package com.kpf.springcloud.common;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.atomic.AtomicLong;

/**
 * 创建唯一订单号
 *
 * @author shiwen
 * @date 2021/3/11
 */
public class CreateOrderNo {

    private static AtomicLong seq = new AtomicLong(0L);

    /**
     * 生成订单号
     */
    public static String createOderNO() {
        SimpleDateFormat fm = new SimpleDateFormat("yyyyMMddHHmmss");
        return String.format("%s%06d",fm.format(new Date()), (int) seq.getAndIncrement() % 1000000);
    }

}